package cn.tedu.springdemo.bean;

import cn.tedu.springdemo.ann.MyService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

//@Component
@MyService
public class Student {
    private Logger logger = LoggerFactory.getLogger(Student.class);
    private String name = "小明";

//    // @Autowired
//    public Student(Pen pen){
//        this.pen = pen;
//    }
    //@Autowired
    @Resource
    private Pen pen;

    //@Autowired
    //@Qualifier("brush")
    public void setPen(Pen pen) {
        this.pen = pen;
    }

    public void study(){
        logger.debug("{} 使用 {} 学习", name, pen);
    }
}
